﻿using Sgr.Domain.Repositories;
using Sgr.Exceptions;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace Sgr.UPMS.Domain.Roles
{
    /// <summary>
    ///
    /// </summary>
    public interface IRoleRepository : IBaseRepositoryOfTEntityAndTPrimaryKey<Role, long>
    {
        /// <summary>
        /// 根据角色ID集合获取对应的资源列表
        /// </summary>
        /// <param name="roleIds"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<IEnumerable<string>> GetResourcesByRoleIdsAsync(long[] roleIds, CancellationToken cancellationToken = default);

        /// <summary>
        /// 角色名称是否唯一
        /// </summary>
        /// <param name="name"></param>
        /// <param name="excludedId"></param>
        /// <param name="orgId"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<bool> NameIsUniqueAsync(string name, long? excludedId = null, long orgId = 0, CancellationToken cancellationToken = default);
    }
}